/* Y o u r   D e s c r i p t i o n                       */
/*                            AppBuilder Photon Code Lib */
/*                                         Version 2.01  */

/* Standard headers */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

/* Local headers */
#include "ablibs.h"
#include "abimport.h"
#include "proto.h"


int
sch_select ( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtWidget_t 	*child;
	char		*val = NULL;
	short 		*state;

	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;
	for (child = PtWidgetChildBack (ABW_PtSchemeGroup); child;
    	 child = PtWidgetBrotherInFront (child))
	{
    	PtGetResource (child, Pt_ARG_ONOFF_STATE, &state, 0);
    	if (*state == 1) {
	   		PtGetResource (child, Pt_ARG_USER_DATA, &val, 0);
	   		PtSetResource (child, Pt_ARG_FILL_COLOR, Pg_RED, 0);
    	} 
    	else {
	   		PtSetResource (child, Pt_ARG_FILL_COLOR, PgRGB (217, 217, 217), 0);
    	}
  	}

	if (val) {
		PtSetResource (ABW_CwLadder1, Cw_LADDER_SELECT, atoi (val), 0);
		PtSetResource (ABW_PtSchemeScroll, Pt_ARG_SCROLLAREA_POS_X, 0, 0); 
		PtSetResource (ABW_PtSchemeScroll, Pt_ARG_SCROLLAREA_POS_Y, 0, 0); 
	}

	return ( Pt_CONTINUE );
}

